package net.huashitong.ssydt.provider.config;

import net.huashitong.comment.ApiCommentManager;
import net.huashitong.comment.config.CommentConfig;
import net.huashitong.ssydt.provider.constant.SsydtConsts;
import net.huashitong.user.UserManager;
import net.huashitong.user.config.UserConfig;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author <a href="mailto:yhy23456@163.com">huiyang.yu</a>
 * @since 2017.08.07
 */
@Configuration
public class HstSDKConfiguration {

    @Bean
    @ConfigurationProperties("net.huashitong.user")
    public UserConfig userConfig() {
        return new UserConfig(SsydtConsts.PRODUCT_CODE, SsydtConsts.VERSION);
    }

    @Bean
    public UserManager userManager() {
        return new UserManager(userConfig());
    }

    @Bean
    @ConfigurationProperties("net.huashitong.comment")
    public CommentConfig commentConfig() {
        return new CommentConfig(SsydtConsts.PRODUCT_CODE, SsydtConsts.VERSION);
    }

    @Bean
    public ApiCommentManager apiCommentManager() {
        return new ApiCommentManager(commentConfig());
    }

}
